From: Jo-Philipp Wich Date: Fri, 3 Jul 2020 12:30:30 +0000 (+0200) Subject: luci-base: ui.js: order menu entries with the same weight by name X-Git-Url: http://git.openwrt.org/%22https:/collectd.org//%22http:/www.crowdsec.net/%22/%22https:/collectd.org/%22http:/www.crowdsec.net/%22?a=commitdiff_plain;h=01058512352f49546e38765c01cf317898ef771d;p=project%2Fluci.git luci-base: ui.js: order menu entries with the same weight by name The previous server side menu rendering ordered items first by their order weight value, then by their internal name. Do the same for client side menu rendering. Signed-off-by: Jo-Philipp Wich (cherry picked from commit 0c479891ae31bbe308c4d6e181c118ec3d65c05f) --- diff --git a/modules/luci-base/htdocs/luci-static/resources/ui.js b/modules/luci-base/htdocs/luci-static/resources/ui.js index 8f81576344..5d6b2e43f7 100644 --- a/modules/luci-base/htdocs/luci-static/resources/ui.js +++ b/modules/luci-base/htdocs/luci-static/resources/ui.js @@ -3056,7 +3056,13 @@ var UIMenu = baseclass.singleton(/** @lends LuCI.ui.menu.prototype */ { } return children.sort(function(a, b) { - return ((a.order || 1000) - (b.order || 1000)); + var wA = a.order || 1000, + wB = b.order || 1000; + + if (wA != wB) + return wA - wB; + + return a.name > b.name; }); } });